package org.example.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.example.entity.system.User;
import org.example.mapper.UserMapper;
import org.example.service.UserService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 魏锴
 * @description 针对表【tb_sys_user】的数据库操作Service实现
 * @createDate 2024-01-03 17:43:36
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User>
        implements UserService {


    @Override
    public User getUser(String username) {
        return baseMapper.getUser(username);
    }
    public User getUserById(int user_id){return baseMapper.getUserById(user_id);}
    @Override
    public String getPasswordByUser(int id) {
        return baseMapper.getPasswordByUser(id);
    }
    public boolean updatePassword(String password,int user_id){
        return baseMapper.updatePassword(password, user_id);
    }

    @Override
    public boolean insertUser(User user) {
        return baseMapper.insertUser(user);
    }

    @Override
    public boolean updateUser(User user) {
        return baseMapper.updateUser(user);
    }

    @Override
    public boolean deleteUser(int id) {
        return baseMapper.deleteUser(id);
    }

    @Override
    public List<User> getUserList() {
        return baseMapper.getUserList();
    }
    public boolean updateUserInfo(int user_id,String username,String avatar){
        return baseMapper.updateUserInfo(user_id,username,avatar);
    }
    @Override
    public String getAvatar(int user_id) {
        return baseMapper.getAvatar(user_id);
    }

    @Override
    public void saveAvatar(int user_id, String file_name) {
        baseMapper.saveAvatar(user_id, file_name);
    }

}




